﻿namespace NTLib.Pipe.Targets
{
    using NTLib.Core.Component;
    using NTLib.Pipe.Descriptors;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// Provider used to create a specific target from informations.
    /// </summary>
    public interface ITargetProvider : IComponent
    {
        #region Properties

        /// <summary>
        /// Gets the information type managed.
        /// The child type will be associate.
        /// This collection will be used to associate a provider to the information give.
        /// </summary>
        IEnumerable<Type> InfoTypeManaged { get; }

        /// <summary>
        /// Gets a value indicating whether this instance is enabled.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance is enabled; otherwise, <c>false</c>.
        /// </value>
        bool IsEnabled { get; }

        #endregion

        #region methods

        /// <summary>
        /// Locates the target using the info give in parameters and return all the possible ways to achived to the target.
        /// </summary>
        /// <typeparam name="U">Type of the information container.</typeparam>
        /// <param name="info">The information use to locate the specifique target.</param>
        /// <returns>All the possible way to reach the target.</returns>
        Task<IEnumerable<ITargetDescriptor>> LocateAsync<U>(U information, CancellationToken token = default(CancellationToken)); 

        #endregion
    }
}
